<?php
namespace app\admin\model;

use app\common\model\Base;

/** 管理员类
 * Class Admin
 * @package zzcms\admin\model
 */
class Admin extends Base
{
    protected $pk = 'id';
    protected $name = 'admin';
    protected $autoWriteTimestamp = true;
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';

    /**
     * 获取列表
     */
    public function getDetail($id)
    {
        $info = $this->getOne($id);
        //判断管理级别
        if ($info['founder'] == 1) {
            $info['level'] = 1;
        } else {
            $info['level'] = $info['parent_id'] == 1 ? 2 : 3;
        }
        return $info;

    }
}